<?php

defined('__MAPEXEC__') or die('No direct access allowed');

/**
 * Manages a group of separate poly lines.
 */
class Maps_Map_PolyLineManager extends Maps_Collection {
  
  /**
   * Class constructor.
   * @param   string  Item Id prefix
   * @param   string  Collection Id
   * @return  void
   */
  public function __construct($prefix=null, $id='') {
    if ( empty($prefix) ) {
      $prefix = 'line_';
    }
    parent::__construct($prefix, $id);
  }
  
  /**
   * Adds a line to this collection.
   * @param   Maps_Map_PolyLine   Line object
   * @return  integer             Number of lines in this collection
   */
  public function add(Maps_Map_PolyLine $line) {
    $this->addItem($line);
    return $line->getId();
  }
  
  /**
   * Creates an empty poly line object
   * @param   void
   * @return  Maps_Map_PolyLine   Empy poly line object
   */
  public function create() {
    return new Maps_Map_PolyLine(null, $this->createId());
  }
  
}

?>